<template>
	<view class="success-list-container">
		<scroll-view class="scroll-view" scroll-y>
			<view class="success-list" v-if="successList.length != 0">
				<view class="success-item" v-for="(item, index) in successList" :key="index">
					<image :src="item.avatar" class="avatar" />

					<view class="item-right">
						<view class="person-name">{{ item.name }}</view>
						<view class="record-time">{{ item.recordTimeData }}</view>
					</view>
				</view>
			</view>
			<view class="gray"></view>
		</scroll-view>
	</view>
</template>

<script>
/**
 * 考勤成功列表
 */
import { common } from '@/pagesA/utils/common.js';
import moment from 'moment';
const app = getApp();
export default {
	data() {
		return {
			successList: []
		};
	},
	onLoad(options) {},
	onShow() {
		if (app.globalData.hasTakePhotoData) {
			let successList = app.globalData.takePhotoData;
			for (let successItem of successList) {
				successItem.recordTimeData = successItem.recordTime ? moment(successItem.recordTime).format('YYYY-MM-DD HH:mm:ss') : '';
				successItem.avatar = common.commonMethods.imgShow(successItem.avatar);
			}
			// this.setData({
			// 	successList
			// });
			this.successList = successList;
			delete app.globalData.hasTakePhotoData;
			delete app.globalData.takePhotoData;
		}
	},
	methods: {}
};
</script>
<style>
.success-list-container {
	display: flex;
	flex-direction: column;
	height: 100vh;
	background-color: #f6f7fa;
}

.scroll-view {
	height: 0;
	flex: 1;
}

.success-list {
	background-color: #fff;
	padding: 0 32rpx;
	margin-top: 15rpx;
}

.gray {
	height: 15rpx;
}

.success-item {
	padding: 32rpx 0;
	display: flex;
	border-bottom: 1rpx solid #e1e2e7;
}

.success-item:last-child {
	border-bottom: 0;
}

.item-right {
	position: relative;
	bottom: 6rpx;
}

.avatar {
	width: 82rpx;
	height: 82rpx;
	border-radius: 12rpx;
	margin-right: 24rpx;
	flex-shrink: 0;
}

.person-name {
	font-size: 34rpx;
	font-family: PingFangSC-Medium, PingFang SC;
	font-weight: 550;
	color: #1e253f;
	word-break: break-all;
	margin-bottom: 16rpx;
}

.record-time {
	font-size: 28rpx;
	font-family: PingFangSC-Regular, PingFang SC;
	font-weight: 400;
	color: #949dbf;
}
</style>
